package org.jeecg.modules.util;

import org.jetbrains.annotations.NotNull;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class HashMapEx<K,V> extends HashMap<K, V> {
    private final HashMap<K,V> map;
    public  HashMapEx(){
        map = new HashMap<>();
    }

    public int size() {
        return map.size();
    }
    public boolean isEmpty() {
        return map.size() == 0;
    }
    public V get(Object key) {
      return map.get(key);
    }
    public boolean containsKey(Object key) {
        return map.containsKey(key);
    }

    public boolean containsValue(Object value) {
        return map.containsValue(value);
    }

    public V put(K key, V value) {
        return map.put(key,(V)ToolsUtils.formatNumber(value));
    }

    public V remove(Object key) {
        return map.remove(key);
    }

    public void putAll(@NotNull Map<? extends K, ? extends V> m) {
        map.putAll(m);
    }

    public void clear() {
        map.clear();
    }

    @NotNull
    public Set<K> keySet() {
        return map.keySet();
    }

    @NotNull
    public Collection<V> values() {
        return map.values();
    }

    @NotNull
    public Set<Map.Entry<K, V>> entrySet() {
        return map.entrySet();
    }

    public HashMap<K, V> getMap() {
        return map;
    }
}
